import Router from 'vue-router';
import Vue from 'vue';
Vue.use(Router);

export default new Router({
    // mode: 'history',
    routes: [{
            path: '/',
            redirect: '/product'
        },

        {
            path: '/product',
            // 路由对应组件
            component: () => import('@/views/product/index'),
            redirect: '/product/list',
            // 配置子路由
            children: [{
                    path: 'list',
                    component: () => import('@/views/product/children/list')
                },
                {
                    path: 'detail/:productId',
                    name: 'detail',
                    component: () => import('@/views/product/children/detail')
                }
            ]
        },
        {
            path: '/classify',
            component: () => import('@/views/classify/classification')
        },
        {
            path: '/submit',
            component: () => import('@/views/submit/index')
        },
        {
            path: '/order',
            component: () => import('@/views/order/index'),

            children: [{
                    path: '/order/orders',
                    component: () => import('@/views/order/orders/settlement')
                },
                {
                    path: '/order/orderdetail/:orderId',
                    component: () => import('@/views/order/orders/orderdetail')
                }
            ]

        },
        {
            path: '/pay',
            component: () => import('@/views/pay/index')
        },
        {
            path: '/cart',
            component: () => import('@/views/cart/shopping')
        },
        {
            path: '/my',
            name: 'getmy',
            component: () => import('@/views/my/index'),
            redirect: '/my/personalCenter',
            children: [{
                    path: '/my/personalCenter',
                    component: () => import('@/views/my/theLogin/personalCenter')
                }, {
                    path: '/my/registered',
                    component: () => import('@/views/my/theLogin/registered')
                },
                {
                    path: '/my/theNo',
                    component: () => import('@/views/my/theLogin/theNo')
                },
                {
                    path: '/my/setting',
                    component: () => import('@/views/my/theLogin/setting')
                },
                {
                    path: '/my/order',
                    component: () => import('@/views/my/theLogin/order')
                },
                {
                    path: '/my/orderDetails',
                    component: () => import('@/views/my/theLogin/orderDetails')
                },
            ]

        },

        {
            path: '/demo',
            component: () => import('@/components/Demo')
        },
        {
            path: '*',
            component: () => import('@/components/NotFound')
        }
    ]
});